package com.financing.wap.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import com.financing.wap.dao.IRecommentProductDao;
import com.financing.wap.util.SqlName;
import com.financing.wap.vo.RecommentProductVO;

@Repository("recommentProductDaoImpl")
public class RecommentProductDaoImpl extends BaseDaoImpl<RecommentProductVO, Integer> implements IRecommentProductDao {
	
	@Override
	public List<RecommentProductVO> queryRecommentProduct(String recommentType) throws SQLException {
		List<RecommentProductVO> fundInfoList=null;
		List<RecommentProductVO> projectList=null;
		try {
			fundInfoList = this.sqlMapClientTemplate.queryForList(SqlName.queryCommentFundInfoList,recommentType);
			projectList = this.sqlMapClientTemplate.queryForList(SqlName.queryCommentProjectList,recommentType);
		} catch (DataAccessException e) {
			e.printStackTrace();
		}
		if(fundInfoList==null||fundInfoList.size()==0){
			return projectList;
		}
		if(projectList==null||projectList.size()==0){
			return fundInfoList;
		}
		projectList.addAll(fundInfoList);
		return projectList;
	}

	@Override
	public Class<RecommentProductVO> getEntityClass() {
		return RecommentProductVO.class;
	}


}
